
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YCKOKO
 * Date: 2022-11-24
 * Time: 12:10
 */
public class Test {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();
        System.out.print("前序遍历：");
        binaryTree.preOrder(root);
        System.out.println();
        System.out.print("中序遍历：");
        binaryTree.inOrder(root);
        System.out.println();
        System.out.print("后序遍历：");
        binaryTree.postOrder(root);
        System.out.println();
        System.out.println("该二叉树的节点个数为:" + binaryTree.size(root));
        System.out.println("该二叉树的节点个数为:" + binaryTree.size2(root));
        System.out.println("该二叉树的叶子节点个数为:" + binaryTree.getLeafNodeCount1(root));
        System.out.println("该二叉树的叶子节点个数为:" + binaryTree.getLeafNodeCount2(root));
        System.out.println("该二叉树的第k层节点个数为:" + binaryTree.getKLevelNodeCount(root, 2));
        System.out.println("该二叉树的第k层节点个数为:" + binaryTree.getKLevelNodeCount(root, 4));
        System.out.println("该二叉树的高度为:" + binaryTree.getHeight(root));
        System.out.println("val值在该二叉树是否存在:" + binaryTree.find(root, 'D'));
        System.out.println("val值在该二叉树是否存在:" + binaryTree.find(root, 'Q'));
        System.out.print("层序遍历：");
        binaryTree.levelOrder(root);
        System.out.println();
        System.out.println("该二叉树是否为完全二叉树：" + binaryTree.isCompleteTree(root));
    }


    public static void main1(String[] args) {
        MyBinaryTree myBinaryTree = new MyBinaryTree();
        MyBinaryTree.TreeNode root = myBinaryTree.createTree();

        System.out.println("该二叉树的节点个数为" + myBinaryTree.size(root));
        System.out.println("该二叉树的叶子节点个数为" + myBinaryTree.getLeafNodeCount(root));

    }
}
